import request from '@/utils/request';
import { FarmLandQuery,FarmLandVO,FarmLandForm,DepartVO,
  WoodlandQuery,EFenceVO,EFenceQuery,
   WoodlandVO,WoodlandForm,PondForm,PondQuery,PondVO,SpaceForm,SpaceQuery,SpaceVO,WarmForm,WarmQuery,WarmVO} from './types';
import { AxiosPromise } from 'axios';
// 查询农田列表
export function listFarmLand(query: FarmLandQuery): AxiosPromise<FarmLandVO[]> {
  return request({
    url: '/base/farmland/list',
    method: 'post',
    data: query
  });
}

// 查询详情
export function getFarmDetail(id: string | number): AxiosPromise<FarmLandVO> {
  return request({
    url: '/base/farmland/detail?id=' + id,
    method: 'get'
  });
}

// 新增农田
export function addFarmLand(data: FarmLandForm) {
  return request({
    url: '/base/farmland/add',
    method: 'post',
    data: data
  });
}

// 修改农田
export function updateFarm(data: FarmLandForm) {
  return request({
    url: '/base/farmland/update',
    method: 'post',
    data: data
  });
}

// 部门
export function getDepart(): AxiosPromise<DepartVO[]> {
  return request({
    url: '/system/dept/optionselect',
    method: 'get'
  });
}
// // 删除公告
//修改状态
export function handleFormStatus(id: Array<String>, status: boolean) {
  return request({
    url: '/base/farmland/enable ',
    method: 'post',
    data:{
      id:id,
      status:status
    }
  });
}

// 查询林地列表
export function listWoodland(query: WoodlandQuery): AxiosPromise<WoodlandVO[]> {
  return request({
    url: '/base/woodland/list',
    method: 'post',
    data: query
  });
}

// 查询详情
export function getWoodlandDetail(id: string | number): AxiosPromise<WoodlandVO> {
  return request({
    url: '/base/woodland/detail?id=' + id,
    method: 'get'
  });
}

// 新增林地
export function addWoodland(data: WoodlandForm) {
  return request({
    url: '/base/woodland/add',
    method: 'post',
    data: data
  });
}

// 修改林地
export function updateWoodland(data: WoodlandForm) {
  return request({
    url: '/base/woodland/update',
    method: 'post',
    data: data
  });
}

// // 删除公告
//修改林地状态
export function handleWoodlandStatus(id: Array<String>, status: boolean) {
  return request({
    url: '/base/woodland/enable ',
    method: 'post',
    data:{
      id:id,
      status:status
    }
  });
}

// 查询塘列表
export function listPond(query: PondQuery): AxiosPromise<PondVO[]> {
  return request({
    url: '/base/pond/list',
    method: 'post',
    data: query
  });
}

// 查询详情
export function getPondDetail(id: string | number): AxiosPromise<PondVO> {
  return request({
    url: '/base/pond/detail?id=' + id,
    method: 'get'
  });
}

// 新增塘
export function addPond(data: PondForm) {
  return request({
    url: '/base/pond/add',
    method: 'post',
    data: data
  });
}

// 修改塘
export function updatePond(data: PondForm) {
  return request({
    url: '/base/pond/update',
    method: 'post',
    data: data
  });
}

// // 删除公告
//修改塘状态
export function handlePondStatus(id: Array<String>, status: boolean) {
  return request({
    url: '/base/pond/enable ',
    method: 'post',
    data:{
      id:id,
      status:status
    }
  });
}

// 查询空地列表
export function listSpace(query: SpaceQuery): AxiosPromise<SpaceVO[]> {
  return request({
    url: '/base/vacant/land/list',
    method: 'post',
    data: query
  });
}

// 查询详情
export function getSpaceDetail(id: string | number): AxiosPromise<SpaceVO> {
  return request({
    url: '/base/vacant/land/detail?id=' + id,
    method: 'get'
  });
}

// 新增空地
export function addSpace(data: SpaceForm) {
  return request({
    url: '/base/vacant/land/add',
    method: 'post',
    data: data
  });
}

// 修改空地
export function updateSpace(data: SpaceForm) {
  return request({
    url: '/base/vacant/land/update',
    method: 'post',
    data: data
  });
}

// // 删除公告
//修改空地状态
export function handleSpaceStatus(id: Array<String>, status: boolean) {
  return request({
    url: '/base/vacant/land/enable ',
    method: 'post',
    data:{
      id:id,
      status:status
    }
  });
}
// 查询片区列表
export function listWarm(query: WarmQuery): AxiosPromise<WarmVO[]> {
  return request({
    url: '/base/warm_village_area/list',
    method: 'post',
    data: query
  });
}

// 查询详情
export function getWarmDetail(id: string | number): AxiosPromise<WarmVO> {
  return request({
    url: '/base/warm_village_area/detail?id=' + id,
    method: 'get'
  });
}

// 新增片区
export function addWarm(data: WarmForm) {
  return request({
    url: '/base/warm_village_area/add',
    method: 'post',
    data: data
  });
}

// 修改片区
export function updateWarm(data: WarmForm) {
  return request({
    url: '/base/warm_village_area/update',
    method: 'post',
    data: data
  });
}

// // 删除公告
//修改片区状态
export function handleWarmStatus(id: Array<String>, status: boolean) {
  return request({
    url: '/base/warm_village_area/enable ',
    method: 'post',
    data:{
      id:id,
      status:status
    }
  });
}

// 查询电子围栏列表
export function listEFence(query: EFenceQuery): AxiosPromise<EFenceVO[]> {
  return request({
    url: '/base/e_fence/list',
    method: 'post',
    data: query
  });
}
